package tralalaClient;


import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;


public class RMIServiceLocator{
	// The Cache
	private TralalaControler Service;


    /** Creates a new instance of RMIServiceLocator */
    public RMIServiceLocator(){ 
     
    }

    public void setService(String[] args) {
    	
    	// Add your code to get the TARGET reference HERE
    	if (args.length != 3)
		{
			System.out.println("uso: java [policy] [codebase] cliente.Cliente [host] [port] [server]");
			System.exit(0);
		}

		if (System.getSecurityManager() == null)
		{
			System.setSecurityManager(new RMISecurityManager());
		}

		try
		{
		String nameAdmin = "//" + args[0] + ":" + args[1] + "/" + args[2];
    	    	
		Service = (TralalaControler) java.rmi.Naming.lookup(nameAdmin);
    
    	
		}catch (Exception e)
		{
			
		}
    	
    }
    public TralalaControler getService() {
    	return Service;
    }
  
}
